package com.one.rope.mvp.basecore.exception;

/**
 * @author Weijian.liu
 * @desc 基础异常类
 * @date 2018/11/26
 */
public class BaseException extends RuntimeException {

  private static final long serialVersionUID = 132598409325409L;
  public static final int FAILURE_CODE = -2;
  public static final int USERFAILURE_CODE = -1;

  private int code = USERFAILURE_CODE;
  private String msg;

  public BaseException(int code, String msg) {
    super();
    this.code = code;
    this.msg = msg;
  }

  public BaseException(String message) {
    super(message);
    this.msg = message;
  }

  public BaseException(String message, Throwable cause) {
    super(message, cause);
  }

  public int getCode() {
    return code;
  }

  public String getMsg() {
    return msg;
  }

  @Override
  public String toString() {
    return this.getClass().getSimpleName() + " [code=" + code + ", msg=" + msg + "]";
  }

}